"use client";
import { ReactNode, useEffect, useState } from "react";
import { DefaultTheme, ThemeProvider as StyledThemeProvider } from "styled-components";

const fuckBrowser = ["UCBrowser", "MQQBrowser", "browserplus"];

const ThemeProvider = ({ children, theme }: { theme: DefaultTheme; children: ReactNode }) => {
    const [_theme, setTheme] = useState(theme);

    useEffect(() => {
        // alert(navigator.userAgent);
        //在uc浏览器或夸克等极为先进的浏览器对背景高斯模糊样式的支持令人发指
        //在这些浏览器中不使用背景模糊效果
        // if (fuckBrowser.some((b) => navigator.userAgent.indexOf(b) !== -1)) {
        //     setTheme(() => ({ replaceBg: "background: #44733b;opacity:0.9;" }));
        // }
    }, []);

    return <StyledThemeProvider theme={_theme}>{children}</StyledThemeProvider>;
};

export default ThemeProvider;
